package com.pifuke.adapter;

import android.content.Context;
import android.widget.TextView;
import cn.o.app.adapter.IItemView;
import cn.o.app.adapter.OAdapter;
import cn.o.app.adapter.OItemView;
import cn.o.app.ui.OImageView;
import cn.skinapp.R;

import com.lidroid.xutils.BitmapUtils;
import com.smiier.skin.net.entity.Comment;
import com.smiier.skin.utils.CommonUtility;

public class TreatmentCommentsAdapter extends OAdapter<Comment> {
	protected BitmapUtils mBitmapUtils;

	@Override
	protected void onContainerChanged() {
		mBitmapUtils = new BitmapUtils(getContext());
	}

	@Override
	public IItemView<Comment> getItemView() {
		return new TreatmentProjectCommentsItemView(getContext());
	}

	class TreatmentProjectCommentsItemView extends OItemView<Comment> {

		public TreatmentProjectCommentsItemView(Context context) {
			super(context);

		}

		OImageView mImage;
		TextView mComment;
		TextView mName;
		TextView mTime;

		@Override
		public void onCreate() {
			setContentView(R.layout.comment_item);
			mImage = findViewById(R.id.imgLayout_show, OImageView.class);
			mComment = findViewById(R.id.treatment_comment, TextView.class);
			mName = findViewById(R.id.treatment_doctor_name, TextView.class);
			mTime = findViewById(R.id.treatment_time, TextView.class);

		}

		@Override
		public void onResume() {
			mComment.setText(mDataProvider.comments);
			mName.setText(mDataProvider.doctor_name);
			mTime.setText(mDataProvider.commentstime.toString());
			// mBitmapUtils.display(mImage, mDataProvider.user_pic,
			// new OBitmapLoadCallBack<View>());
			// 项目医生评论没有性别
			CommonUtility.displayHeadImage(mImage, mBitmapUtils,
					mDataProvider.user_pic, getContext().getResources(), 0);
		}

	}
}
